﻿<!DOCTYPE html>
<html lang="en" dir="ltr">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <title>个性签名</title>
    <link rel="stylesheet" type="text/css" href="../plugins/weui/css/weui.min.css">
    <link rel="stylesheet" type="text/css" href="../css/base.css">
    <link rel="stylesheet" type="text/css" href="../css/css.css">
</head>
<style>
    body{ background-color: #F3F3F3;}
    .weui-input{ height:280px; background-color:#fff; }
    .input-box{margin-top:10px; padding-left:10px; padding-right:10px;background-color:#fff;}
    body .btn-add {color: white;background: #ff8427; width:90%;}
</style>

<body>
    <div class="container">
        <!--标签列表-->
        <div class="label-set mb25 label-list">
            <div class="weui-cell__bd input-box" >
                <textarea id="sign" onkeyup="onkey()" class="weui-input" placeholder="请填写个性签名" ></textarea>
                <div id="signcount" style="float:right;margin-top:-20px;position:relative;"><span id="rightcount">0</span>/<span id="leftcount">500</span></div>
            </div>
        </div>
        <div class="make-button">
            <a href="javascript:;" class="weui-btn  btn-add">保存</a>
        </div>

    </div>
    <script src="../js/jquery-2.1.4.min.js"></script>
    <script src="../js/base.js"></script>
    <script>
        $(function () {
            load()
        })

        function load() {
            ajaxGet(siteApiList.GetInfo + "?id=" + staffId, function (data) {
                if (!isJsonSuccess(data))
                    return;
                var item = data.Data;
                $("#sign").val(item.Sign);
                var sign = $('#sign').val();
                $('#rightcount').text(sign.length);
                loadBtn();
            })
        }
        function onkey() {
            var sign = $('#sign').val();
            $('#rightcount').text(sign.length);
            if (sign.length > 500) {
                Alert("字数超过范围。");
            }
        }
        function loadBtn() {
            $(".btn-add").click(function () { updateSign() })
        }

        //添加标签
        function updateSign() {
            var sign = $("#sign").val();    
            if (trim(sign) == "") {
                Alert("请填写个性签名");
                return;
            }
            ajaxPost(siteApiList.UpdateSign, "staffid=" + staffId + "&sign=" + sign, function (data) {
                if (!isJsonSuccess(data))
                    return;
                Alert("保存成功");
            });
        }
    </script>
</body>

</html>
